10 Minutes With BIND

Today I decided to spend a little time getting a nameserver set up for my local network, because typing IP addresses is annoying. To my surprise, BIND is installed on FreeBSD systems by default so I got to forego that step and move straight to the juicy stuff.

Configuration is extremely simple, at least for a basic configuration like mine. I dove into this article and followed along into my named.conf file:

zone "example.net" {
type master;
file "master/example.net";
};

zone "0.168.192.in-addr.arpa" {
type master;
file "master/0.168.192.in-addr.arpa";
};


This sets up two "zones": one for normal name lookups and one for reverse, IP lookups. I simply added a few hosts to each file and set my resolver to use the server.

example.net:
...
; Machines
IN A 192.168.0.102
router IN A 192.168.0.1
zoidberg IN A 192.168.0.102
fry IN A 192.168.0.100

; Aliases
www IN CNAME @


0.168.192.in-addr.arpa:
...
1 IN PTR router.example.net.
100 IN PTR fry.example.net.
102 IN PTR zoidberg.example.net.

Since I use DHCP, I had to find a way to use my new name server while not making my entire LAN dependent upon it as a result of pointing to it from my router. The solution is to add the following options to your /etc/dhclient.conf file:

upersede domain-name "example.net";
#for the dns machine:
prepend domain-name-servers 127.0.0.1;
# for other clients:
prepend domain-name-servers 192.168.0.102;



The result is that I can now use "nice" names on my local network.